package com.swgk.core.recyclerview.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

public class MainHomePagerAdapter extends FragmentStatePagerAdapter {

    private String[] menu;
    private List<Fragment> list;

    public MainHomePagerAdapter(FragmentManager fm, String[] menu, List<Fragment> list) {
        super(fm);
        this.menu = menu;
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return menu.length;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return menu[position];
    }

    public void setMenu(String[] menu) {
        this.menu = menu;
    }

    public void setList(List<Fragment> list) {
        this.list = list;
    }

    @Override
    public int getItemPosition(@NonNull Object object) {
        return POSITION_NONE;
    }
}
